<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <script>
            let obj = {
                name: 'wangjin',
                age: 22,
            };
            // console.log(obj.name);
            // console.log(obj.age);

            // let { name, age } = { name: 'wangjin', age: 22 };
            let { age, name } = { name: 'wangjin', age: 22 };

            // let name = 'wangjin';
            // let age = 22
            console.log(name);
            // console.log(sex);

            let arr = [1, 2];
            let [a, b] = arr;
            console.log(a);
            console.log(b);

            let obj2 = {
                names: 'wangjin',
                hobby: {
                    h1: 'lanqiu',
                    h2: 'shuijiao',
                },
            };

            let {
                names,
                hobby: { h1 },
            } = obj2;
            console.log(h1);

            let ary = [1, 2, 3, [4, 5]];
            let [q, w, e, [r, t]] = ary;
            console.log(r);
            console.log(t);

            let aa = 1,
                bb = 2;
            console.log([aa, bb]);
            [bb, aa] = [aa, bb];
            // console.log(aa);
            // console.log(bb);
            console.log([aa, bb]);
        </script>
    </body>
</html>
